using System.Collections.Generic;
using System.Threading.Tasks;

public class BYAPIDataController : OnlineDataController
{   
    static OnlineDataController _instance;
    public static OnlineDataController instance
    {
        get
        {
            if (_instance == null)
                _instance = new BYAPIDataController();
            return _instance;
        }
    }
    public const string BYAPI_Lisence = "FFDB1431-FDD0-4148-8073-6D8358AF8FEF";
    public override string  getAllStocksDataURL => $"http://api.biyingapi.com/hslt/list/{BYAPI_Lisence}";
    public override string getAllTransitionsDataURL(string stock) => $"https://api.biyingapi.com/hszbl/fsjy/{stock}/dn/{BYAPI_Lisence}";
    /// <summary>
    /// 每分钟的主力资金走势
    /// </summary>
    /// <param name="stock"></param>
    /// <returns></returns>
    public override string getZhuLiZiJinURL(string stock) => $"http://api.biyingapi.com/hsmy/zlzj/{stock}/{BYAPI_Lisence}";
    public override string getZiJinLiuRuURL(string stock) => $"http://api.biyingapi.com/hsmy/zjlr/{stock}/{BYAPI_Lisence}";
    public  string get10DayZiJinLiuRuURL(string stock) => $"http://api.biyingapi.com/hsmy/zhlrt/{stock}/{BYAPI_Lisence}";
    public override string getJieDuanZhuLiURL(string stock) => $"http://api.biyingapi.com/hsmy/jddx/{stock}/{BYAPI_Lisence}";
    public  string get10DayJieDuanZhuLiURL(string stock) => $"http://api.biyingapi.com/hsmy/jddxt/{stock}/{BYAPI_Lisence}";
    public override string getChengJiaoFenBuURL(string stock) => $"http://api.biyingapi.com/hsmy/lscj/{stock}/{BYAPI_Lisence}";
    public  string get10DayChengJiaoFenBuURL(string stock) => $"http://api.biyingapi.com/hsmy/lscjt/{stock}/{BYAPI_Lisence}";
    public override string getCompanyFundInfoURL(string stock)=> $"http://api.biyingapi.com/hscp/cwzb/{stock}/{BYAPI_Lisence}";
    
    public async Task<List<ZiJinLiuRuData>> Request10DayZiJinLiuRuData(string stockCode)
    {
        return await RequestListData<ZiJinLiuRuData>(get10DayZiJinLiuRuURL(stockCode));
    }  
    public async Task<List<JieDuanZhuLiData>> Request10DayJieDuanZhuLiData(string stockCode)
    {
        return await RequestListData<JieDuanZhuLiData>(get10DayJieDuanZhuLiURL(stockCode));
    }  
    public async Task<List<ChengJiaoFenBuData>> Request10DayChengJiaoFenBuData(string stockCode)
    {
        return await RequestListData<ChengJiaoFenBuData>(get10DayChengJiaoFenBuURL(stockCode));
    }  
    
    public override async Task<List<StockData>> RequestAllStocksData()
    {
        return await RequestListData<StockData>(getAllStocksDataURL);
    }
    public override  async Task<List<TransitionData>>  RequestAllTransitionsData(string stockCode)
    {
        return await RequestListData<TransitionData>(getAllTransitionsDataURL(stockCode));
    }
    public override async Task<List<ZhuLiZiJinData>> RequestZhuLiZiJinData(string stockCode)
    {
        return await RequestListData<ZhuLiZiJinData>(getZhuLiZiJinURL(stockCode));
    } 
    public override async Task<List<ZiJinLiuRuData>> RequestZiJinLiuRuData(string stockCode)
    {
        return await RequestListData<ZiJinLiuRuData>(getZiJinLiuRuURL(stockCode));
    }  
    
    public override async Task<List<JieDuanZhuLiData>> RequestJieDuanZhuLiData(string stockCode)
    {
        return await RequestListData<JieDuanZhuLiData>(getJieDuanZhuLiURL(stockCode));
    }
    public override async Task<List<ChengJiaoFenBuData>> RequestChengJiaoFenBuData(string stockCode)
    {
        return await RequestListData<ChengJiaoFenBuData>(getChengJiaoFenBuURL(stockCode));
    }

    public override async Task<CompanyFundInfo> RequestCompanyFundInfo(string stockCode)
    {
        return await RequestData<CompanyFundInfo>(getCompanyFundInfoURL(stockCode));
    }
}